{% extends "base.html" %}
{% block title %}任务管理{% endblock %}
{% block navbar %}{{ super() }}{% endblock %}
{% block styles %}{{ super() }}
<style>
    .main-div {
        background: #ffffff none repeat scroll 0 0;
        border-radius: 2px;
        margin: 10px auto 30px;
        max-width: 80%;
        padding: 20px 20px 20px 20px;
    }

    body {
        padding-top: 100px;
    }
</style>
<link href="{{ url_for('static', filename='datatables/datatables.min.css') }}" rel="stylesheet">
{% endblock %}








{% block scripts %}
{{super()}}
<script src="{{ url_for('static', filename='datatables/datatables.min.js') }}"></script>
<script src="{{ url_for('static', filename='datatables/jquery.dataTables.min.js') }}"></script>
<script src="{{ url_for('static', filename='datatables/dataTables.buttons.min.js') }}"></script>
<script src="{{ url_for('static', filename='datatables/buttons.flash.min.js') }}"></script>
<script src="{{ url_for('static', filename='datatables/jszip.min.js') }}"></script>
<script src="{{ url_for('static', filename='datatables/pdfmake.min.js') }}"></script>
<script src="{{ url_for('static', filename='datatables/vfs_fonts.js') }}"></script>
<script src="{{ url_for('static', filename='datatables/buttons.html5.min.js') }}"></script>
<script src="{{ url_for('static', filename='datatables/buttons.print.min.js') }}"></script>
<script>
    // datatable
    $(function () {
        // $('#weeklytimesheet').DataTable(
        $('#dt').DataTable(
            {

                "search": {
                    "regex": true
                },
                dom: '<"top"flipB<"clear">>rt<"bottom"ipB<"clear">>',
                buttons: [
                    'copy', 'csv', 'excel'
                ],

                //"order": [[0, "asc"]],
                // "order": [],
                "order": [[9, "desc"]],

                "autoWidth": false

            });
    });




</script>
{% endblock %}
{% block content %}


<div class="container">
    <div class="row">
        <div class="col-xs-1 col-sm-1 col-md-1 col-lg-1"></div>
        <div class="col-xs-10 col-sm-10 col-md-10 col-lg-10">
            {% include 'flash_message.html' %}
            <table id="dt" class="row-border hover compact" style="width:100%">
                <thead>
                    <tr>
                        <th>ID</th>
                        <th>用户</th>
                        <th>大类</th>
                        <th>分类</th>
                        <th>工作令号</th>
                        <th>工时</th>
                        <th>日期</th>
                        <th>任务</th>
                        <th>备注</th>
                        <th>创建日期</th>
                        <th>修改日期</th>
                        <th>删除标识</th>
                        <th>操作</th>
                        <th>操作</th>
                    </tr>
                </thead>
                <tbody>
                    {% for task in tasks %}
                    <tr>
                        <td>{{ task.id }}</td>
                        <td>{{ task[12] }}</td>
                        <td>{{ task[13] }}</td>
                        <td>{{ task[14] }}</td>
                        <td>{{ task[15] }}</td>
                        <td>{{ task[7] }}</td>
                        <td>{{ task[8] }}</td>
                        <td>{{ task.title }}</td>
                        <td>{{ task.remark }}</td>
                        <td>{{ task[9] }}</td>
                        <td>{{ task[10] }}</td>
                        <td>{{ task[11] }}</td>
                        <td><a href="{{ url_for('bp_admin.admin_task_edit', taskid=task[0]) }}">编辑</a></td>
                        <td><a href="{{ url_for('bp_admin.admin_task_delete', taskid=task[0]) }}">
                                {% if task[11] %}
                                恢复
                                {% else %}
                                删除
                                {% endif %}
                            </a></td>
                    </tr>
                    {% endfor %}
                </tbody>
            </table>
        </div>
        <div class="col-xs-1 col-sm-1 col-md-1 col-lg-1"></div>
    </div>
</div>
{% endblock %}